// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: declaration of CImplSwitch.
//   $Id$


#pragma once
#include "SingleNodeBinding.h"

class CXFormsElementSwitch;
class CImplCase;
class CImplSwitch : public CImplSingleNodeBinding
{
	friend class CXFormsParseSwitch;
	//Switch isn't really a form control, but it does need to
	//	be initialised and attached.
public:
	virtual HRESULT AddChild(CImpl* pImpl);
	CImplSwitch(CXFormsElementSwitch* pSource);
	virtual ~CImplSwitch();

	void AddItem(CImplCase* pCase);
	HRESULT toggle(CImplCase* pCase);
	HRESULT init(CImpl * pParent);
	virtual HRESULT refresh();
	void removeCaseReference(CImplCase * pCase);
protected:
	virtual HRESULT  doInitialize();

private:
	HRESULT SelectInitialCase();
	CTypedPtrList<CPtrList, CImplCase*> m_Cases;
	CImplCase* m_pCurrentCase;
};

